<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ page session="false"%>
<%@ page contentType="text/html; charset=UTF-8"%>

<div class="left_content">
	<div id="zhishilist">
	<!-- 
	<c:forEach items="${data}" var="row">
		<div class="node">
		<div class="head"><c:out value="${row.title}" /></div>
		<div class="body"><c:out value="${row.content}" /></div>
		<div class="foot"><span class="time"><c:out
			value="${row.indb}" /></span> <c:if test="${row.tags != ''}">
			<span class="tags">标签:<c:out value="${row.tags}" /></span>
		</c:if></div>
		</div>
	</c:forEach>
	-->
	</div>
	<div id="pagelist">
		<a href="javascript:void(0);" title="上一页">上一页</a>
		<a href="javascript:void(0);" title="最后浏览页">最后浏览页</a>
		<a href="javascript:void(0);" title="下一页">下一页</a>
	</div>
</div>

<div class="right_content">
	<div id="login" class="tip_box">
		<div class="title">欢迎登陆</div>
		<form action="" method="post">
			<div class="tips"></div>
			<p>
				<label for="username">用户名：</label><input type="text" name="username" class="userpass" size="24"/>
			</p>
			<p>
				<label for="password">密　码：</label><input type="password" name="password" class="userpass" size="24"/>								
			</p>
			<p class="btn">
				<input type="button" value=" 登 录 " class="btn_login"/>
				<a href="user/index" target="_blank" class="reg">免费注册</a>
			</p>
			<span class="remember">
				<input type="checkbox" name="RemenberMe" checked="checked"/>
				<label for="RemenberMe">记住我</label>
			</span>
			<a href="" target="_blank" class="forget" name="forget">忘记密码？</a>
		</form>						
	</div>
	<div id="me" class="tip_box">
		<img src="images/me.jpg"/>
		<div class="name">这就是我</div>
	</div>
	<div class="tip_box">
		<h2>消息或者列表</h2>
		<p class="tips">这里是消息消息消息消息消息消息消息消息
		</p>
		<a href="#" class="read_more">read more</a>
	</div>
</div>			
			 
		
<script language="JavaScript" type="text/javascript">
	//<![CDATA[
	$(function(){
		try{
			var lastPage=1;//看的最后页
			var curPage=1;

			function loadPage(page){
				$.getJSON("aixue/list",{page:page},function(json){
					try{
						var data=json.data;
						var html=new Array();
						for(var i=0;i<data.length;i++){
							//下面的这段过程应该可以独立出来作为一个组件
							//对于json方面的拼接字符串的操作，应该可以更简洁点
							var zhishi=data[i];
							html.push('<div class="node">');
							html.push('<div class="head">'+zhishi.title+'</div>');								
							html.push('<div class="body">'+zhishi.content+'</div>');
							html.push('<div class="foot">');
							html.push('<span class="time">'+zhishi.indb+'</span>');
							html.push('<span class="tags">标签:'+zhishi.tags+'</span>');								
							html.push('</div>');
							html.push('</div>');
						}
						html=html.join("\n");
						$("#zhishilist").html(html);
					}catch(e){alert(e);}
				});	
			}
			
			//前一页
			$("#pagelist a:first").click(function(event){
					if(curPage>1){
						var page=curPage-1;
						loadPage(page);
						curPage-=1;
					}
					return false;
				});
			//后一页
			$("#pagelist a:last").click(function(event){							
					var page=curPage+1;
					loadPage(page);
					curPage+=1;
					if(curPage>lastPage){
						lastPage=curPage;
					}
					return false;
				});
			//最后浏览页面
			$("#pagelist a:eq(1)").click(function(event){							
					var page=lastPage;
					loadPage(page);
					curPage=lastPage;
					return false;
				});

			$("#pagelist a:eq(1)").click();

			
		}catch(e){alert(e);}
	});
	//]]>
</script>